﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Entity;
using BLL;

namespace BookStore.Controllers
{
    public class PersonalController : Controller
    {
        //个人用户中心
        // GET: /Personal/Index

        public static List<BookInformatica> list;
        public static List<OrderInformatica> list1;

        public void adr()
        {
            int a = Convert.ToInt32(Request.Cookies["User"].Values["UserId"]);
            list = new List<BookInformatica>();
            list1 = new List<OrderInformatica>();
            list1 = BLL.X_BOr.GetOrderinfo(a);
        }

        public ActionResult Index()
        {
            adr();
            //List<BookInformatica> bbb = new List<BookInformatica>();
            ViewBag.ph = list;
            ViewBag.info = list1;
            return View();
        }

        //获取用户信息
        public JsonResult UserInfo()
        {
            UserInfo u = new Entity.UserInfo();
            u.UserId = 4;
            List<UserInfo> ui = T_BUserInfo.UserInfomaction(u);
            return Json(ui, JsonRequestBehavior.AllowGet);
        }
        //评价回显
        [HttpPost]
        public JsonResult Upj(string bookid)
        {
            list = X_BOr.Pjhx(bookid);

            return Json(list, JsonRequestBehavior.AllowGet);
            //return Json(list);
        }
        [HttpPost]
        public ActionResult Inpj(string bdid,string tval)
        {
            //int bookid, int userid, string cv, DateTime dt
           int b= Convert.ToInt32(Request.Cookies["User"].Values["UserId"]);
           int vid = Convert.ToInt32(bdid);
           
          string dt = DateTime.Now.ToString(); 
           int aaa= X_BOr.Inserpj(vid,b,tval,dt);
           return Json(aaa);
        }
        public ActionResult Address()
        {
            return View();
        }

    }
}
